package com.xinya.taobaosale.ui.adapter;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import androidx.lifecycle.Lifecycle;
import androidx.viewpager2.adapter.FragmentStateAdapter;

import java.util.List;

/**
 * @ClassName: MainContainerAdapter$
 * @Description: java类作用描述
 * @Author: xinya
 * @CreateDate: 2021/2/7$ 14:07$
 * @UpdateRemark: 更新内容
 * @Version: 1.0
 */
public class MainContainerAdapter extends FragmentStateAdapter {
    private List<Fragment> mFragmentList;

    public MainContainerAdapter(@NonNull List<Fragment> fragmentList,
                                @NonNull FragmentManager fragmentManager,
                                @NonNull Lifecycle lifecycle) {
        super(fragmentManager, lifecycle);
        this.mFragmentList = fragmentList;
    }

    @NonNull
    @Override
    public Fragment createFragment(int position) {
        return mFragmentList.get(position);
    }

    @Override
    public int getItemCount() {
        return mFragmentList.size();
    }
}
